package com.springcloudserver.controller;

import com.springcloudserver.common.AjaxResult;
import com.springcloudserver.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: chenzuolin
 * @time: 2021/3/22 21:39
 */
@RestController
@RequestMapping("/consume")
public class UserInfoController {

    @Autowired
    private UserInfoService baseService;


    @GetMapping("/findById/{id}")
    public AjaxResult findById(@PathVariable("id") String id){
        if (id == null) AjaxResult.error("参数为空！！！");
        return AjaxResult.success(baseService.findById(id));
    }

    @GetMapping("/findAll")
    public AjaxResult findAll(){
        return AjaxResult.success(baseService.findAll());
    }
}
